package com.teradyne.merlin2.ui.client;

import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceChangeEvent;
import com.teradyne.merlin2.ui.client.views.AppLayout;

public final class PlaceLayoutHandler implements PlaceChangeEvent.Handler {

	private final AppLayout appPanelView;
	private Place currentPlace;

	public PlaceLayoutHandler(AppLayout appPanelView) {
		this.appPanelView = appPanelView;
	}

	@Override
	public void onPlaceChange(PlaceChangeEvent event) {
		Place newPlace = event.getNewPlace();
		if (newPlace != currentPlace) {
			appPanelView.setDefaultLayout();
			currentPlace = newPlace;
		}
	}
}
